/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package SYSGEST.br.Entrada;

import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Mesopotanea
 */
public class EntradaModel extends AbstractTableModel{
   List<Entrada> entrada = new ArrayList<Entrada>();
   private String[] entColum = {"Codigo","Codigo de Barras","Produto", "Quantidade"};
    
    
    public EntradaModel(List <Entrada> saidas){
        this.entrada.clear();
        this.entrada.addAll(saidas);
    }

    

    @Override
    public int getRowCount() {
        return entrada.size();
    }

    @Override
    public int getColumnCount() {
        return entColum.length;
    }

  
    

    @Override
   public Object getValueAt(int rowIndex, int columnIndex){
      Entrada sd = entrada.get(rowIndex);
       switch(columnIndex){
           case 0:
               return sd.getProdu().getCodigo();
            case 1:
               return sd.getProdu().getCodBarras();
           case 2: 
               return sd.getProdu().getProduto();
           case 3:
               return sd.getQtdEntrada();
       }
       return null;
   }
    @Override
       public String getColumnName(int column){
           
          switch(column){
           case 0:
               return entColum[0];
           case 1: 
               return entColum[1];
           case 2:
               return entColum[2];
           case 3:
               return entColum[3];
       }
          return null;
       }
    
    
}
    

